{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "from collections import defaultdict\n",
    "import itertools\n",
    "from IPython.display import Image\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "import scipy.signal as sign\n",
    "import scipy.stats as stats\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'\\\\10.40.12.80\\\\home\\PhD\\Results\\Competition\\DL\\Four-Arena Setup\\WT_mating_status\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 60\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [4.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figureS2')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h', '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h', '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['virgin_virgin', 'virgin_mated24h', 'virgin_mated2h']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['video_2017-09-05T14_34_55_arena4', 'video_2017-09-12T14_36_55_arena4', 'video_2017-09-14T13_34_41_arena2', 'video_2017-09-21T14_47_10_arena3', 'video_2017-09-21T14_47_10_arena4', 'video_2017-09-26T13_40_19_arena4', 'video_2017-09-27T16_21_07_arena1', 'video_2017-09-27T16_21_07_arena3', 'video_2017-09-28T15_55_49_arena2', 'video_2017-10-12T14_34_41_arena2', 'video_2017-10-18T14_05_05_arena3', 'video_2017-10-19T14_58_20_arena1', 'video_2017-10-24T14_48_34_arena1', 'video_2017-10-24T14_48_34_arena4', 'video_2017-10-25T13_39_35_arena4', 'video_2017-11-03T14_54_45_arena2', 'video_2017-09-05T15_42_04_arena1', 'video_2017-11-02T16_11_06_arena1', 'video_2017-12-19T16_23_33_arena4', 'video_2017-09-05T15_42_04_arena3', 'video_2017-09-07T13_28_02_arena4']\n",
      "21\n"
     ]
    }
   ],
   "source": [
    "# Create a list of all the experiments that we DO NOT want to analyze.\n",
    "intruders = []\n",
    "for condition in conditions:\n",
    "    for file in os.listdir(condition):\n",
    "        if 'quality_control' in file:\n",
    "\n",
    "            # Read the quality.csv file to check which experiments are usable for analysis.\n",
    "            quality_file = os.path.join(condition, file)\n",
    "            quality_df = pd.read_csv(quality_file, usecols=[0,1], index_col=0)\n",
    "            quality_df = quality_df[quality_df['is_usable'] == False].index.values\n",
    "            \n",
    "            for value in quality_df:\n",
    "                intruders.append(value)\n",
    "\n",
    "print(intruders)             \n",
    "print(len(intruders))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " virgin_mated24h\n",
      "Copulation too short: video_2017-09-20T14_48_55_arena3\n",
      "\t\n",
      " virgin_mated2h\n",
      "\t\n",
      " virgin_virgin\n",
      "Copulation too short: video_2017-09-06T13_42_13_arena3\n",
      "Copulation too short: video_2017-09-26T14_52_18_arena3\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_virgin': ['\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T13_28_41_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T14_34_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T13_42_13_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T14_45_32_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-08T13_26_13_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T13_30_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T14_36_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T16_18_15_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-13T14_34_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T13_43_53_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T14_48_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T13_38_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T15_57_23_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-26T13_40_19_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T13_36_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T14_44_01_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T15_55_49_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-12T15_50_43_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-13T16_06_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-18T15_19_17_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-19T13_50_56_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T13_21_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T15_44_09_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-24T16_13_35_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-25T14_55_12_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T13_37_48_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T14_48_28_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T16_11_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T14_54_45_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T16_20_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T12_58_51_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T14_01_01_arena3'],\n",
       " 'virgin_mated24h': ['\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-05T13_28_41_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-07T16_01_26_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-08T14_31_59_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-08T14_31_59_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-12T13_30_06_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-13T15_40_03_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-14T14_47_16_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-20T13_43_53_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-26T14_52_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-09-27T15_06_20_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-11T13_30_05_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-11T16_00_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-13T14_37_35_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T13_50_56_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T14_58_20_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-19T16_19_37_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-20T14_31_24_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-20T14_31_24_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-24T13_43_26_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T13_39_35_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T14_55_12_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-25T14_55_12_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-26T13_35_36_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-10-26T14_43_16_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T13_38_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated24h\\\\video_2017-11-03T16_20_50_arena3'],\n",
       " 'virgin_mated2h': ['\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-06T15_53_34_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-07T16_01_26_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-07T16_01_26_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-08T15_42_18_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-08T15_42_18_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-13T15_40_03_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-14T15_53_40_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-20T16_07_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-21T15_57_23_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-21T15_57_23_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-26T16_06_31_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-26T16_06_31_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-09-28T15_55_49_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-11T16_00_50_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-12T15_50_43_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-13T16_06_33_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-18T16_37_02_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-18T16_37_02_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-19T16_19_37_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-19T16_19_37_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-25T16_23_26_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-10-25T16_23_26_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-11-02T16_11_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T15_13_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T15_13_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-19T16_23_33_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_mated2h\\\\video_2017-12-20T15_08_53_arena2']}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.is_dir() and item.name not in intruders:\n",
    "\n",
    "            annotation_video = annotations.read(item.path + '.csv')\n",
    "            \n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "\n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    print('Copulation interrupted:', item.name)\n",
    "                    continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print('Copulation too short:', item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError:\n",
    "                continue\n",
    "\n",
    "            experiments[condition].append(item.path)\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "virgin_virgin \n",
      "\n",
      "video_2017-09-05T13_28_41_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-05T14_34_55_arena2\n",
      "Number of aggressive bouts is: 6\n",
      "Number of clean detected \"encounters\" is: 11\n",
      "Number of detected aggressive bouts is: 6\n",
      "1.0 \n",
      "\n",
      "video_2017-09-06T13_42_13_arena1\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 14\n",
      "Number of detected aggressive bouts is: 3\n",
      "1.0 \n",
      "\n",
      "video_2017-09-06T14_45_32_arena3\n",
      "Number of aggressive bouts is: 11\n",
      "Number of clean detected \"encounters\" is: 10\n",
      "Number of detected aggressive bouts is: 11\n",
      "1.0 \n",
      "\n",
      "video_2017-09-07T14_37_38_arena3\n",
      "Number of aggressive bouts is: 7\n",
      "Number of clean detected \"encounters\" is: 3\n",
      "Number of detected aggressive bouts is: 0\n",
      "0.0 \n",
      "\n",
      "video_2017-09-07T14_37_38_arena4\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 9\n",
      "Number of detected aggressive bouts is: 3\n",
      "1.0 \n",
      "\n",
      "video_2017-09-08T13_26_13_arena3\n",
      "Number of aggressive bouts is: 8\n",
      "Number of clean detected \"encounters\" is: 26\n",
      "Number of detected aggressive bouts is: 8\n",
      "1.0 \n",
      "\n",
      "video_2017-09-12T13_30_06_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-12T14_36_55_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-12T16_18_15_arena4\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 9\n",
      "Number of detected aggressive bouts is: 2\n",
      "1.0 \n",
      "\n",
      "video_2017-09-13T14_34_18_arena2\n",
      "Number of aggressive bouts is: 4\n",
      "Number of clean detected \"encounters\" is: 20\n",
      "Number of detected aggressive bouts is: 4\n",
      "1.0 \n",
      "\n",
      "video_2017-09-20T13_43_53_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-20T14_48_55_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-21T13_38_55_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 6\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-09-21T15_57_23_arena2\n",
      "Number of aggressive bouts is: 12\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 11\n",
      "0.9166666666666666 \n",
      "\n",
      "video_2017-09-26T13_40_19_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-28T13_36_06_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-28T14_44_01_arena3\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 24\n",
      "Number of detected aggressive bouts is: 3\n",
      "1.0 \n",
      "\n",
      "video_2017-09-28T15_55_49_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-12T15_50_43_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-13T16_06_33_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-18T15_19_17_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-19T13_50_56_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-20T13_21_06_arena2\n",
      "Number of aggressive bouts is: 4\n",
      "Number of clean detected \"encounters\" is: 13\n",
      "Number of detected aggressive bouts is: 3\n",
      "0.75 \n",
      "\n",
      "video_2017-10-20T15_44_09_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-24T16_13_35_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 10\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-10-25T14_55_12_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-11-02T13_37_48_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-11-02T14_48_28_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-11-02T16_11_06_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-11-03T14_54_45_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-11-03T16_20_50_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-12-20T12_58_51_arena4\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 2\n",
      "1.0 \n",
      "\n",
      "video_2017-12-20T14_01_01_arena3\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 17\n",
      "Number of detected aggressive bouts is: 2\n",
      "0.6666666666666666 \n",
      "\n",
      "virgin_mated24h \n",
      "\n",
      "video_2017-09-05T13_28_41_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-07T16_01_26_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-08T14_31_59_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-08T14_31_59_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-12T13_30_06_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-13T15_40_03_arena1\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 12\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-09-14T14_47_16_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-20T13_43_53_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-26T14_52_18_arena2\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 4\n",
      "Number of detected aggressive bouts is: 1\n",
      "0.5 \n",
      "\n",
      "video_2017-09-27T15_06_20_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-11T13_30_05_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-11T16_00_50_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-13T14_37_35_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-13T14_37_35_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-13T14_37_35_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-19T13_50_56_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-19T14_58_20_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-19T16_19_37_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-20T14_31_24_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-20T14_31_24_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-24T13_43_26_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-25T13_39_35_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-25T14_55_12_arena2\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 5\n",
      "Number of detected aggressive bouts is: 0\n",
      "0.0 \n",
      "\n",
      "video_2017-10-25T14_55_12_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-26T13_35_36_arena2\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 13\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-10-26T14_43_16_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-11-03T13_38_06_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-11-03T13_38_06_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-11-03T13_38_06_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 12\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-11-03T16_20_50_arena3\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 11\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "virgin_mated2h \n",
      "\n",
      "video_2017-09-06T15_53_34_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-07T16_01_26_arena1\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 13\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-09-07T16_01_26_arena2\n",
      "Number of aggressive bouts is: 4\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 4\n",
      "1.0 \n",
      "\n",
      "video_2017-09-08T15_42_18_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-08T15_42_18_arena3\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 13\n",
      "Number of detected aggressive bouts is: 2\n",
      "1.0 \n",
      "\n",
      "video_2017-09-13T15_40_03_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-09-14T15_53_40_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-20T16_07_55_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-21T15_57_23_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-21T15_57_23_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-09-26T16_06_31_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-26T16_06_31_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-09-28T15_55_49_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-11T16_00_50_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-11T16_00_50_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-11T16_00_50_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-12T15_50_43_arena4\n",
      "No encounters for this experiment\n",
      "\n",
      "video_2017-10-13T16_06_33_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-18T16_37_02_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-18T16_37_02_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-19T16_19_37_arena1\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 6\n",
      "Number of detected aggressive bouts is: 1\n",
      "1.0 \n",
      "\n",
      "video_2017-10-19T16_19_37_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-25T16_23_26_arena1\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-10-25T16_23_26_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-11-02T16_11_06_arena4\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-12-19T15_13_55_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-12-19T15_13_55_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-12-19T16_23_33_arena1\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 12\n",
      "Number of detected aggressive bouts is: 3\n",
      "1.0 \n",
      "\n",
      "video_2017-12-19T16_23_33_arena2\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-12-19T16_23_33_arena3\n",
      "No aggression for this experiment\n",
      "\n",
      "video_2017-12-20T15_08_53_arena2\n",
      "No aggression for this experiment\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Initialize empty data structures to store data.\n",
    "encounters_df = pd.DataFrame()\n",
    "\n",
    "flags = {condition: {} for condition in condition_order}\n",
    "clean_dict = {condition: {} for condition in condition_order}\n",
    "intersection_fractions = {condition: {} for condition in condition_order}\n",
    "\n",
    "# Start a counter to use as the index for our temporary dataframes in the loop.\n",
    "n = 0\n",
    "for condition in condition_order:\n",
    "    \n",
    "    print(condition, '\\n')\n",
    "    \n",
    "    for experiment_path in experiments[condition]:\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "\n",
    "        # Fetch tracking data.\n",
    "        control = True if condition == 'virgin_virgin' else False\n",
    "        aggression_df, _, copulation_interval, aggression_timepoints = helpers.process_track_data(experiment_path,\n",
    "                                                                                                  trackfeat_columns=['dist_to_other'],\n",
    "                                                                                                  is_control=control,\n",
    "                                                                                                  fly_id=2,\n",
    "                                                                                                  include_aggression_only=False\n",
    "                                                                                                 )\n",
    "\n",
    "        # Keep only frames within copulation time.\n",
    "        sliced_aggression = aggression_df.loc[copulation_interval[0]:copulation_interval[0]+(5*60*FPS)]\n",
    "        aggression_timepoints = [event for event in aggression_timepoints if event[0] < copulation_interval[0]+(5*60*FPS)]\n",
    "\n",
    "        raw = []\n",
    "        clean = []\n",
    "\n",
    "        # Apply threshold(s).\n",
    "        proximity = sliced_aggression['dist_to_other'].values < 4\n",
    "\n",
    "        # Detect event start and end, and package them into a list of tuples.\n",
    "        if proximity[0] == True:\n",
    "            proximity = np.insert(proximity, 0, False)\n",
    "        proximity_onset = proximity[:-1] < proximity[1:]\n",
    "        proximity_offset = proximity[:-1] > proximity[1:]\n",
    "        onset_indices = np.where(proximity_onset==True)[0] + copulation_interval[0]\n",
    "        offset_indices = np.where(proximity_offset==True)[0] + copulation_interval[0]\n",
    "\n",
    "        raw_events = list(zip(onset_indices, offset_indices))\n",
    "        if len(raw_events) > 0:\n",
    "            \n",
    "            if len(raw_events) == 1:\n",
    "                clean_events = raw_events\n",
    "            else:\n",
    "                # Combine events that are very close to each other into a single event.\n",
    "                clean_events = helpers.stitch_events(raw_events, suppress=True)\n",
    "\n",
    "            assert len(clean_events) <= len(raw_events), 'Stitched events list is bigger than original list: {} vs {}'.format(len(clean_events), len(raw_events))\n",
    "\n",
    "            clean_dict[condition][experiment] = clean_events\n",
    "\n",
    "            # Check for abnormally long \"encounters\", which might be indicative of tracking issues.\n",
    "            clean_events_durations = [event[1] - event[0] for event in clean_events]\n",
    "            long_durations = np.where(np.array(clean_events_durations) >= 3600)[0] # filter for bouts that are 1 minute or longer.\n",
    "            if len(long_durations) != 0:\n",
    "                flags[condition][experiment] = [clean_events[index][0] for index in long_durations]\n",
    "\n",
    "            # Get accuracy for our detector.\n",
    "            if len(aggression_timepoints) > 0:\n",
    "                nd_aggression, _, accuracy, intersect = helpers.calc_detection_accuracy(aggression_timepoints, clean_events, threshold=0.25, use_thresh=True)\n",
    "\n",
    "                intersection_fractions[condition][experiment] = intersect\n",
    "                n_bout_overlaps = len(intersect)\n",
    "                print(accuracy, '\\n')\n",
    "\n",
    "            else:\n",
    "                n_bout_overlaps = 0\n",
    "                print('No aggression for this experiment\\n')\n",
    "        \n",
    "        # In case a given experiment has no proximity encounters whatsoever.\n",
    "        else:\n",
    "            clean_dict[condition][experiment] = []\n",
    "            clean_events_durations = []\n",
    "            nd_aggression = 0\n",
    "            accuracy = 0\n",
    "            intersect = []\n",
    "            intersection_fractions[condition][experiment] = 0\n",
    "            n_bout_overlaps = 0\n",
    "            print('No encounters for this experiment\\n')\n",
    "        \n",
    "        # From the extracted data, calculate all the variables we need.\n",
    "        copulation_duration = np.diff(copulation_interval)[0]\n",
    "        aggression_total_frame_duration = sum([np.diff(timepoint)[0] for timepoint in aggression_timepoints])\n",
    "        n_encounter_frames = sum(clean_events_durations)\n",
    "        encounters_frame_ratio = n_encounter_frames / (5 * 60 * FPS)\n",
    "        aggression_frame_ratio = aggression_total_frame_duration / n_encounter_frames if n_encounter_frames > 0 else 0\n",
    "        fraction_aggressive_encounters = nd_aggression / len(clean_events) if len(aggression_timepoints) > 0 else 0\n",
    "        fraction_aggressive_encounters = fraction_aggressive_encounters if fraction_aggressive_encounters <= 1 else 1\n",
    "        \n",
    "        # Create a one-row pandas DataFrame to store all the information we've calculated.\n",
    "        temp_df = pd.DataFrame(data={'condition': condition,\n",
    "                                     'experiment': experiment,\n",
    "                                     'copulation_duration': copulation_duration,\n",
    "                                     'aggression_duration': aggression_total_frame_duration,\n",
    "                                     'n_bouts_aggression': len(aggression_timepoints),\n",
    "                                     'has_aggression': True if len(aggression_timepoints) > 0 else False,\n",
    "                                     'n_encounters': len(clean_events),\n",
    "                                     'fraction_aggressive_encounters': fraction_aggressive_encounters,\n",
    "                                     'encounters_frame_ratio': encounters_frame_ratio,\n",
    "                                     'aggression_frame_ratio': aggression_frame_ratio,\n",
    "                                     'n_bout_overlaps': n_bout_overlaps\n",
    "                                    },\n",
    "                               index=[n]\n",
    "                              )\n",
    "        \n",
    "        # Store the current experiment's data into our global DataFrame.\n",
    "        encounters_df = pd.concat([encounters_df, temp_df], axis=0)\n",
    "        \n",
    "        # Increment our counter.\n",
    "        n += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>copulation_duration</th>\n",
       "      <th>aggression_duration</th>\n",
       "      <th>n_bouts_aggression</th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>n_encounters</th>\n",
       "      <th>fraction_aggressive_encounters</th>\n",
       "      <th>encounters_frame_ratio</th>\n",
       "      <th>aggression_frame_ratio</th>\n",
       "      <th>n_bout_overlaps</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "      <td>42083</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>False</td>\n",
       "      <td>14</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.057889</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "      <td>54966</td>\n",
       "      <td>377</td>\n",
       "      <td>6</td>\n",
       "      <td>True</td>\n",
       "      <td>11</td>\n",
       "      <td>0.545455</td>\n",
       "      <td>0.151889</td>\n",
       "      <td>0.137893</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "      <td>37771</td>\n",
       "      <td>202</td>\n",
       "      <td>3</td>\n",
       "      <td>True</td>\n",
       "      <td>14</td>\n",
       "      <td>0.214286</td>\n",
       "      <td>0.184556</td>\n",
       "      <td>0.060807</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3</td>\n",
       "      <td>51519</td>\n",
       "      <td>770</td>\n",
       "      <td>11</td>\n",
       "      <td>True</td>\n",
       "      <td>10</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.230389</td>\n",
       "      <td>0.185676</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena3</td>\n",
       "      <td>46945</td>\n",
       "      <td>579</td>\n",
       "      <td>7</td>\n",
       "      <td>True</td>\n",
       "      <td>3</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.023833</td>\n",
       "      <td>1.349650</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       condition                        experiment  copulation_duration  \\\n",
       "0  virgin_virgin  video_2017-09-05T13_28_41_arena4                42083   \n",
       "1  virgin_virgin  video_2017-09-05T14_34_55_arena2                54966   \n",
       "2  virgin_virgin  video_2017-09-06T13_42_13_arena1                37771   \n",
       "3  virgin_virgin  video_2017-09-06T14_45_32_arena3                51519   \n",
       "4  virgin_virgin  video_2017-09-07T14_37_38_arena3                46945   \n",
       "\n",
       "   aggression_duration  n_bouts_aggression  has_aggression  n_encounters  \\\n",
       "0                    0                   0           False            14   \n",
       "1                  377                   6            True            11   \n",
       "2                  202                   3            True            14   \n",
       "3                  770                  11            True            10   \n",
       "4                  579                   7            True             3   \n",
       "\n",
       "   fraction_aggressive_encounters  encounters_frame_ratio  \\\n",
       "0                        0.000000                0.057889   \n",
       "1                        0.545455                0.151889   \n",
       "2                        0.214286                0.184556   \n",
       "3                        1.000000                0.230389   \n",
       "4                        0.000000                0.023833   \n",
       "\n",
       "   aggression_frame_ratio  n_bout_overlaps  \n",
       "0                0.000000                0  \n",
       "1                0.137893                6  \n",
       "2                0.060807                3  \n",
       "3                0.185676               11  \n",
       "4                1.349650                0  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "encounters_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## What fraction of \"encounters\" during copulation are aggressive?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t virgin_mated24h \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.010492\n",
      "  All groups were sampled from populations with NOT IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.0038049736080363974 \n",
      "\n",
      "\n",
      "\t virgin_mated2h \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.025399\n",
      "  All groups were sampled from populations with NOT IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.019113131599070576 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_mated24h': 0.0038049736080363974,\n",
       " 'virgin_mated2h': 0.019113131599070576}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fraction_agg_pvalues = {}\n",
    "\n",
    "control = encounters_df.query('condition==\"virgin_virgin\"')['fraction_aggressive_encounters']\n",
    "\n",
    "for condition in condition_order[1:]:\n",
    "        \n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        test = encounters_df.query('condition==\"' + condition + '\"')['fraction_aggressive_encounters']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        fraction_agg_pvalues[condition] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "fraction_agg_pvalues"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Bonferroni Correction\n",
      "---------------------\n",
      "\n",
      "\tOriginal Values:\n",
      " {'virgin_mated24h': 0.0038049736080363974, 'virgin_mated2h': 0.019113131599070576}\n",
      "\n",
      "\tCorrected Values:\n",
      " {'virgin_mated24h': 0.007609947216072795, 'virgin_mated2h': 0.03822626319814115} \n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Bonferroni corretction for multiple comparisons.\n",
    "title = 'Bonferroni Correction'\n",
    "print(title)\n",
    "print('-'*len(title))\n",
    "\n",
    "# Show uncorrected values.\n",
    "print('\\n\\tOriginal Values:\\n', fraction_agg_pvalues)\n",
    "\n",
    "# Apply the bonferroni correction for multiple comparisons.\n",
    "fraction_agg_multi_comp_correction = multipletests(pvals=list(fraction_agg_pvalues.values()), alpha=0.05, method='bonferroni')[1]\n",
    "\n",
    "# Transform the correction results into a dictionary.\n",
    "corrected_fraction_agg_pvalues = dict(zip(list(fraction_agg_pvalues.keys()), fraction_agg_multi_comp_correction))\n",
    "\n",
    "# Show corrected values.\n",
    "print('\\n\\tCorrected Values:\\n', corrected_fraction_agg_pvalues, '\\n')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "virgin_mated24h\n",
      "virgin_mated2h\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Miguel\\Desktop\\paper_data\\paper_code\\figureS2\\helpers.py:466: RuntimeWarning: invalid value encountered in double_scalars\n",
      "  fold_change = median_diff / control_median\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_mated24h': nan, 'virgin_mated2h': nan}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fraction_agg_effect_sizes = {}\n",
    "\n",
    "control = encounters_df.query('condition==\"virgin_virgin\"')['fraction_aggressive_encounters']\n",
    "\n",
    "for condition in condition_order[1:]:\n",
    "    \n",
    "    print(condition)\n",
    "    \n",
    "    test = encounters_df.query('condition==\"' + condition + '\"')['fraction_aggressive_encounters']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "    \n",
    "    fraction_agg_effect_sizes[condition] = median_diff\n",
    "    \n",
    "fraction_agg_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQsAAAEcCAYAAADQhpFxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3deXxM9/7H8dckk12EEBJJxBIEIbHFniiljb3W2IrWXu3VHa0Kt7e/LnS7tFSpWlNUUNRaQVERxBpCLAlBQhbZJ5mc3x/auVLECZnM0M/z8cjj4Xxncs57juST7znne75HoyiKghBCPISFqQMIIZ4MUiyEEKpIsRBCqCLFQgihihQLIYQqUiyEEKqUWbFQFIXhw4cza9YsAPR6PZMmTcLHxwdvb2/mzZtneO+5c+cIDAykQYMGBAQEcObMGVXb0Gg0RsleEjqdjpVhYXww499ERkaaOo4QpaZMikVMTAydOnVizZo1hrb58+cTGxvLyZMnOXToEF9++aXhl2vIkCGMGzeO06dPM2PGDPr168eTMBwkNzeXth2e5aMl29h4Ts/QiVN574MZpo4lRKkok2Ixd+5cRo0aRf/+/Q1t4eHhjBw5Eq1WS8WKFQkJCWHZsmVcvXqVM2fOEBISAkBwcDCZmZkcPXq0LKI+lpVhP5HnXI9qrfviUq8FNbpP4qd1m7h165apownx2MqkWMyZM4fBgwcXaUtISMDT09Ow7OHhwZUrV0hISKBatWpYWFjc89r9hIaGotFozOIQ5Ojxk9hU9TYsazQa7Fy8uHTpkulCCVFKTHaCs7CwsMgvuKIoWFpa3tN+92v3ExoaiqIoZnGY0rVLJzLP/2FY1utyyUqMpUGDBiZMJUTp0Jpqw9WrVycxMdGwnJiYiIeHB9WrV+fatWsoimIoGn+9Zu6ee+452oT/wu/rP8Wmk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jYsSPffPMNcOeEq6+vL9nZ2Tz77LMsXboUgEOHDt333Elpud8+epCePXsa9oXaE9uHDh3C29ub119/nRYtWhAeHn7PvnBycqJOnTosW7YMuNOTDQwMBO787P3Vvnbt2lI/fyMT9qrUtm1b0tPTGT9+fLHvmzZtGiNHjqRx48bUrl0bV1fXIj0PczVr1ixyc3N54403DG3jxo0zzomyu/j5+eHv74+Pjw8WFhY899xz/P7778CdH/6pU6dSoUIF/vvf/zJmzBgaN26MoigsW7YMR0dHZsyYwYgRI2jYsCE+Pj5GPQx50D4qLV26dOHbb7+lQYMGKIpCUFAQJ0+eBO4cto4bN44lS5awfPlyxo0bx6effoq1tTU//fQTGo2GOXPmMGzYML777juaN2+Oo6NjqWUDmbC31C1btoyaNWvStm1b4uPjCQoKIi4u7h/7MB3x9JCeRSnz8fFh3Lhx6PV6LCwsmD9/vhQK8VSQnoUQQhX5kyeEUEWKhRBCFSkWQghVpFgIIVSRYiGEUEWKhRBCFSkWQghVpFgIIVSRYiGEUEWKhRBCFSkWQghVpFgIIVSRYiGEUEWKhRBCFSkWQghVpFgIIVSRYiGEUEWKhRBCFSkWQghV/h84xYuyy0RDJAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 270x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = encounters_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='fraction_aggressive_encounters',\n",
    "            data=encounters_df,\n",
    "            palette=['steelblue', '#d72323', '#fB929e'],\n",
    "            width=0.6,\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            capprops={'color': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='fraction_aggressive_encounters',\n",
    "              data=encounters_df,\n",
    "              palette=['steelblue', '#d72323', '#fB929e'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Aggressive Encounters (%)')\n",
    "axis.set_ylim(0, 1.015)\n",
    "axis.set_yticks(np.arange(0, 1+0.1, 0.2))\n",
    "axis.set_yticklabels([int(y*100) for y in axis.get_yticks()])\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(encounters_df.query('condition==\"'+condition+'\"').shape[0]) for condition in condition_order]\n",
    "row2 = ['virgin\\n', '24h-mated\\n', '2h-mated\\n'] \n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical results.\n",
    "for p, condition in enumerate(condition_order[1:]):\n",
    "    sig_height = 6 if (corrected_fraction_agg_pvalues.get(condition, 'NaN') == 'NaN') or (corrected_fraction_agg_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p+1,\n",
    "                                 x2=p+1,\n",
    "                                 p_value=corrected_fraction_agg_pvalues.get(condition, 'NaN'),\n",
    "                                 y=0.95,\n",
    "                                 ticksize=0,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'percentage_aggressive_encounters_first_5mins_mating_drive'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
